package com.liu.mapper;


import com.liu.entity.Stock;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

@Mapper
@Repository
public interface StockMapper {
    /**
     * 根据主键删除库存
     * @param id
     * @return
     */
    int deleteByPrimaryKey(Integer id);

    int insert(Stock record);

    int insertSelective(Stock record);

    Stock selectByPrimaryKey(Long id);

    Stock selectByGoodsId(Long itemId);

    int decreaseStock(@Param("goodsId") Long goodsId, @Param("amount") Integer amount);

    int updateByPrimaryKeySelective(Stock record);

    int updateByPrimaryKey(Stock record);
}